/**
 * 
 */
package com.hanhai.zrb.backend.task;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.hanhai.common.task.BaseTask;
import com.hanhai.zrb.api.solr.SolrHelper;
import com.hanhai.zrb.api.solr.SolrService;
import com.hanhai.zrb.model.fund.Fund;
import com.hanhai.zrb.model.fund.dto.FundDto;
import com.hanhai.zrb.model.intention.dto.IntentionDto;
import com.hanhai.zrb.model.project.ProjectSolrDto;

/**
 * @author leiruiqi@hanhai.com
 *
 */
@Component
public class SolrImport4FundTask extends BaseTask {
	protected final Logger logger = LoggerFactory.getLogger(SolrImport4FundTask.class);
	
	@Resource
	private SolrService solrService;
	@Override
	public String getBizKey() {
		// TODO Auto-generated method stub
		return "solr_dataimport_fund";
	}

	@Override
	public void doDefaultBiz() {
		logger.info("task "+getBizKey()+" excute start");
		SolrHelper<Fund> solrHelper = new SolrHelper<Fund>(solrService.getSolrFundUrl());
		solrHelper.buildIndex(true);
		logger.info("task "+getBizKey()+" excute end");
	}

	@Override
	public Integer lockTime() {
		// TODO Auto-generated method stub
		return 5;
	}

	@Scheduled(cron="0 2 * * * ? ")//每小时执行1次
	public void doTaskDefaultBiz(){
		super.doDefaultSynBiz();
	}
}
